package defense;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

import javax.swing.JPanel;

public class DefensePanel extends JPanel {
	private static final long serialVersionUID = 6983255183618987336L;

	private Game game;
	
	public DefensePanel() {
		super.setPreferredSize(new Dimension(600, 600));
		game = new Game(this);
	}

	@Override
	public void paintComponent(Graphics g) {
		Graphics2D g2d = (Graphics2D) g;
		
		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		//g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
		//		RenderingHints.VALUE_INTERPOLATION_BILINEAR);
		g2d.setBackground(Color.red.darker().darker());
		g2d.clearRect(0, 0, 0xFFFF, 0xFFFF);
		draw(g2d);
	}

	public void draw(Graphics2D g2d) {
		game.update();
		game.draw(g2d);
	}
}
